package main

import (
	"fmt"
	"log"
	"net/http"
	"grpc-jwt-yonghurenzheng/v0/config"
	"grpc-jwt-yonghurenzheng/v0/handlers"

	"github.com/gorilla/mux"
)

func main() {
	// 初始化数据库
	config.InitDB()

	// 使用 mux 路由
	r := mux.NewRouter()

	// 用户相关
	r.HandleFunc("/register", handlers.Register).Methods("POST")
	r.HandleFunc("/login", handlers.Login).Methods("POST")
	r.HandleFunc("/delete_user", handlers.DeleteUser).Methods("DELETE")
	
	fmt.Println("🚀 服务启动于 http://localhost:8080")
	log.Fatal(http.ListenAndServe(":8080", r))
}
